home *** CD-ROM | disk | FTP | other *** search
- Path: charnel.ecst.csuchico.edu!mcelroy
- From: mcelroy@ecst.csuchico.edu (James Robert McElroy)
- Newsgroups: comp.lang.c++
- Subject: Initializing pointers in MIL???
- Date: 19 Feb 1996 17:52:27 GMT
- Organization: California State University, Chico
- Message-ID: <4gadcr$oqf@charnel.ecst.csuchico.edu>
- NNTP-Posting-Host: hairball.ecst.csuchico.edu
-
- Presented below is a code segment that works on
- the Borland compiler but fails on a Sun compiler.
- The code in question deals with initializing a
- pointer to an object in the MIL using "new" in the
- foo constructor.
-
- The constructor is placed inline for ease of
- demonstrating the problem, but it works (or fails)
- regarless of whether it is inline.
-
- I am wondering if the ARM covers this, and if
- it is legal C++ syntax:
-
-
- class fubar {
- private:
- int x;
- public:
- fubar(int anX): x(anX) { } // no, not here
- };
-
- class foo {
- private:
- fubar * pf;
- public:
- foo(int anInt): pf ( new fubar(anInt)) { } // here!!!
- };
-
-
- --
- Jim McElroy
- Calif. State Univ., Chico
- mcelroy@ecst.csuchico.edu
-